package com.zs.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.gson.Gson;
import com.zs.model.ProjectLogEntity;
import com.zs.model.criteria.BaseCriteria;
import com.zs.query.ProjectLogQuery;
import com.zs.service.ProjectLogService;

@Controller
@RequestMapping("/projectLog")
public class projectLogController {

    @Resource
    private Gson gson;

    @Resource
    private ProjectLogService projectLogService;

    @RequestMapping(value = "list", method = RequestMethod.POST)
    @ResponseBody
    public String selectMessageList(HttpServletRequest request,
                                    @RequestParam(value = "pn", required = true, defaultValue = "1") Integer pageNo,
                                    @RequestParam(value = "ps", required = true, defaultValue = "3") Integer pageSize,
                                    String projectName,String projectId,String projectTeam,String projectLogName,
                                    String startTime,String endTime,String spendTimeMin,String spendTimeMax,String recorder,
                                    Integer auditStatus,String auditContent
    ) {
    	ProjectLogQuery projectLogQuery = new ProjectLogQuery();
    	BaseCriteria baseCriteria = new BaseCriteria();
    	baseCriteria.setPageNo(pageNo);
    	baseCriteria.setPageSize(pageSize);
    	baseCriteria.setStartTime(startTime);
    	baseCriteria.setEndTime(endTime);
    	ProjectLogEntity entity =  new ProjectLogEntity();
    	entity.setProjectId(projectId);
    	entity.setProjectName(projectName);
    	entity.setProjectTeam(projectTeam);
    	entity.setAuditContent(auditContent);
    	entity.setAuditStatus(auditStatus);
    	entity.setProjectLogName(projectLogName);
    	entity.setRecorder(recorder);
    	projectLogQuery.setBaseCriteria(baseCriteria);
    	projectLogQuery.setProjectLogEntity(entity);
    	projectLogQuery.setSpendTimeMax(spendTimeMax);
    	projectLogQuery.setSpendTimeMin(spendTimeMin);
        return (projectLogService.selectProjectLogList(projectLogQuery));
    }
    
}
